﻿Imports System.Data.OleDb
Imports DTO
Public Class LyDoThanhLySachDAO
    Public Function LayDSLyDoThanhLySach() As List(Of LyDoThanhLySachDTO)
        Dim sql As String = "Select MaLyDoThanhLySach,TenLyDoThanhLySach From LYDOTHANHLYSACH"
        DataProvider.OpenConnecttion()
        Dim reader As OleDbDataReader = DataProvider.ExecSelect(sql)
        Dim ds As New List(Of LyDoThanhLySachDTO)()
        While reader.Read
            Dim ld As New LyDoThanhLySachDTO()
            ld.MaLyDoThanhLySach = reader.GetInt32(0)
            ld.TenLyDoThanhLySach = reader.GetString(1)
            ds.Add(ld)
        End While
        DataProvider.CloseConnect()
        Return ds
    End Function

    Public Function ThemLyDoThanhLySach(ByVal sql As String) As Integer
        DataProvider.OpenConnecttion()
        Dim kq As Integer = DataProvider.ExecInsert(sql)
        DataProvider.CloseConnect()
        Return kq
    End Function

    Public Function CapNhatLyDoThanhLySach(ByVal sql As String) As Integer
        DataProvider.OpenConnecttion()
        Dim kq As Integer = DataProvider.ExecInsert(sql)
        DataProvider.CloseConnect()
        Return kq
    End Function
End Class
